<?
function lk_make_new_shareholder($id_user){

	$query="select max(id_shareholder)+1 from ".TABLE_SHAREHOLDER_REGISTRATION." where id_shareholder<'900000'";
	$result=mysql_query($query) or die(mysql_error());
	
	if (mysql_num_rows($result)==0) $id_shareholder=1;
	else {$id_shareholder=mysql_result($result,0,0);}

	$query="insert into ".TABLE_SHAREHOLDER_REGISTRATION." (sign_main,family,prefix_registration,id_co_site,id_shareholder,author_code,accept_status,date_created)
		values('1','".get_email($id_user)."','".domenprefixregistration()."','".domenidsite()."','$id_shareholder','$id_user','".REGISTRATION_ACCEPT_STATUS."','".date('Y-m-d H:i:s')."')";
	$result=mysql_query($query) or die(mysql_error());
	$id_application=mysql_insert_id();
	
	$query="insert into ".TABLE_SHAREHOLDER." (id_application,sign_main,family,prefix_registration,id_co_site,id_shareholder,author_code,accept_status)
		values('$id_application','1','".get_email($id_user)."','".domenprefixregistration()."','".domenidsite()."','$id_shareholder','$id_user','".REGISTRATION_ACCEPT_STATUS."')";
	$result=mysql_query($query) or die(mysql_error());
	
	$query="insert into ".TABLE_SHAREHOLDER_USER." (id_shareholder,id_user,author_code)
		values('$id_shareholder','$id_user','$id_user')";
	$result=mysql_query($query) or die(mysql_error());

}

?>